<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        ul {
            background: #ccc;
            width: 500px;
            height: 200px;
        }
        .hover:hover{
            color: gold;
            background-color: skyblue;
            width: 200px;
        }
    </style>
    <script>
        window.onload = function() {
            let aInput = document.getElementsByTagName("input");
            // let aInput = document.querySelectorAll("input");//另外一种方法
            let oUl = document.getElementById("box");
            aInput = Array.prototype.slice.apply(aInput);
            aInput.forEach(function(val, index) {
                val.onclick = function() {
                    if (index == 0) {
                        oUl.innerHTML = oUl.dataset.name;
                    } else if (index == 1) {
                        oUl.innerHTML = oUl.dataset.sex;
                    } else {
                        oUl.innerHTML = oUl.dataset.age;
                    }
                }
            });
            const money = 20190214;
            // const formats = money.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
            const formats = money.toLocaleString();
            console.log(formats);//20,190,214

            const ids = 10;
            let [RandomId,Random_Id] =  [Math.random().toString(36).substr(3, ids),Math.random().toString(36).substr(3, ids)];
            // const Random_Id =  Math.random().toString(36).substr(3, ids);
            // console.log(RandomId,Random_Id);//生成两个随机id

            const OddEven = num => !!(num & 1) ? "奇数" : "偶数";
            console.log(OddEven(7));
        }
    </script>
</head>
<body>
    <input type="button" value="姓名"><input type="button" value="性别"><input type="button" value="年龄">
    <ul id="box" data-name="curry" data-sex="simon" data-age="30"></ul>
    <div class="hover">我是hover的文字</div>
</body>
</html>